package com.xsf.apache.dubbo.consumer.controller;

import comxsf.apache.dubbo.provider.api.EchoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RefreshScope
public class DubboConsumerController {
    @Reference(version = "1.0.0")
    private EchoService echoService;
    @Value("${user.name}")
    private String username;

    @GetMapping("/get/{name}")
    public String get(@PathVariable String name) {
        return this.echoService.echo(name) + "  name " + this.username;
    }
}
